package com.dly.hope.dao;

import com.dly.hope.model.dto.TempDTO;
import com.dly.hope.modle.QTemplate;
import com.querydsl.core.types.Projections;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author linyu.dai
 * @project myserve
 * @description
 * @creat 2022/11/4 15:15:03
 */
@Repository
public class TemplateDao extends BaseDao{

    public QTemplate basePath(){
        return QTemplate.template1;
    }

    public List<TempDTO> getAll(){
        return queryFactory.select(Projections.bean(
                TempDTO.class,
                basePath().id,
                basePath().template,
                basePath().subject,
                basePath().type
        )).from(basePath()).where(efficient(basePath().dataStatus)).fetch();
    }
}
